import { AvatarColor } from "@douyinfe/semi-ui/lib/es/avatar"
import pinyin from 'pinyin';

const tagColors: AvatarColor[] = [
    "amber", "blue", "cyan", "green", "grey", "indigo",
    "light-blue", "light-green", "lime", "orange", "pink",
    "purple", "red", "teal", "violet", "yellow"
]

export const getTagColor = (index: number) => {
    return tagColors[index % tagColors.length]
}

export const getFirstLetter = (chineseChar: string) => {
    const result = pinyin(chineseChar, {
        style: pinyin.STYLE_FIRST_LETTER, // 设置只获取首字母
        heteronym: false // 不启用多音字模式
    });
    return result[0][0].toUpperCase(); // 返回第一个字的第一个拼音首字母并大写
};


export const getTowFrontLetter = (chineseStr: string) => {
    return getFirstLetter(chineseStr.slice(0, 1)) + getFirstLetter(chineseStr.slice(1, 2));
}

